package com.demo2do.boyle.common.entity.aduser.material;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.demo2do.boyle.common.entity.aduser.Aduser;
import com.demo2do.boyle.common.entity.aduser.AduserBrand;

/**
 * 
 *	素材表
 * 
 * @author Leo
 */
@Entity
@Table(name = "material")
public class Material {

	@Id
	@GeneratedValue
	private Integer id;
	
	@ManyToOne(optional = false, fetch = FetchType.LAZY)
	private Aduser aduser;
	
	private String title;
	
	@Enumerated(EnumType.ORDINAL)
	private Type type;

	@ManyToOne(optional = false, fetch = FetchType.LAZY)
	private AduserBrand brand;
	
	/** 品牌图片 */
	private String brandImage;
	
	/** 投放平台 */
	private int socialType;
	
	/** 文字描述 */
	private String description;	

	/** 当素材类型为链接素材时,才有链接地址*/
	private String link;
	
	private Date createTime;
	
	@Column(name="is_deleted")
	private boolean disabled;
	
	/** 当素材类型为图文素材时,才有图片链接*/
	@OneToMany(mappedBy = "material", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	private List<MaterialImage> materialImages;
	
	/** 当素材类型为关键字时,才有关键字显示*/
	@OneToMany(mappedBy = "material", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	private List<MaterialKeywords> materialKeywords;
	
	/**
	 * The default constructor
	 */
	public Material() {
		
	}

	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @return the aduser
	 */
	public Aduser getAduser() {
		return aduser;
	}

	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @return the type
	 */
	public Type getType() {
		return type;
	}

	/**
	 * @return the brand
	 */
	public AduserBrand getBrand() {
		return brand;
	}

	/**
	 * @return the brandImage
	 */
	public String getBrandImage() {
		return brandImage;
	}

	/**
	 * @return the socialType
	 */
	public int getSocialType() {
		return socialType;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @return the link
	 */
	public String getLink() {
		return link;
	}

	/**
	 * @return the createTime
	 */
	public Date getCreateTime() {
		return createTime;
	}

	/**
	 * @return the disabled
	 */
	public boolean isDisabled() {
		return disabled;
	}

	/**
	 * @return the materialImages
	 */
	public List<MaterialImage> getMaterialImages() {
		return materialImages;
	}
	
	/**
	 * @return the materialKeywords
	 */
	public List<MaterialKeywords> getMaterialKeywords() {
		return materialKeywords;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @param aduser the aduser to set
	 */
	public void setAduser(Aduser aduser) {
		this.aduser = aduser;
	}

	/**
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @param type the type to set
	 */
	public void setType(Type type) {
		this.type = type;
	}

	/**
	 * @param brand the brand to set
	 */
	public void setBrand(AduserBrand brand) {
		this.brand = brand;
	}

	/**
	 * @param brandImage the brandImage to set
	 */
	public void setBrandImage(String brandImage) {
		this.brandImage = brandImage;
	}

	/**
	 * @param socialType the socialType to set
	 */
	public void setSocialType(int socialType) {
		this.socialType = socialType;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @param link the link to set
	 */
	public void setLink(String link) {
		this.link = link;
	}

	/**
	 * @param createTime the createTime to set
	 */
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	/**
	 * @param disabled the disabled to set
	 */
	public void setDisabled(boolean disabled) {
		this.disabled = disabled;
	}

	/**
	 * @param materialImages the materialImages to set
	 */
	public void setMaterialImages(List<MaterialImage> materialImages) {
		this.materialImages = materialImages;
	}
	
	/**
	 * @param materialKeywords the materialKeywords to set
	 */
	public void setMaterialKeywords(List<MaterialKeywords> materialKeywords) {
		this.materialKeywords = materialKeywords;
	}
	
}